<template>
  <div class="deepseek-config">
    <el-alert
      :closable="false"
      title="DeepSeek API 申请地址：https://platform.deepseek.com/usage"
      type="info"
    ></el-alert>
    <el-form
      ref="deepSeekEnvConfig"
      :model="form"
      class="mt10"
      label-width="180px"
    >
      <el-form-item
        label="启用 DeepSeek"
        prop="enabled"
      >
        <el-switch
          v-model="form.enabled"
          active-text="启用"
          inactive-text="禁用"
        />
      </el-form-item>

      <el-form-item
        :rules="[
          {
            required: true,
            message: '请输入APIKey',
            trigger: 'blur'
          }
        ]"
        label="API Key"
        prop="apiKey"
      >
        <el-input
          v-model="form.apiKey"
          placeholder="请输入API Key"
          show-password
          :disabled="!form.enabled"
        />
      </el-form-item>

      <el-form-item
        :rules="[
          {
            required: true,
            message: '请输入Base URL',
            trigger: 'blur'
          }
        ]"
        label="Base URL"
        prop="baseUrl"
      >
        <el-input
          v-model="form.baseUrl"
          placeholder="请输入Base URL"
          :disabled="!form.enabled"
        />
      </el-form-item>
      <!--
      <el-form-item
        :label="$t('system.deepseek.model')"
        prop="model"
      >
        <el-select
          v-model="form.model"
          :placeholder="$t('system.deepseek.selectModel')"
        >
          <el-option
            label="deepseek-chat"
            value="deepseek-chat"
          />
          <el-option
            label="deepseek-coder"
            value="deepseek-coder"
          />
        </el-select>
      </el-form-item>

      <el-form-item
        :label="$t('system.deepseek.timeout')"
        prop="timeout"
      >
        <el-input-number
          v-model="form.timeout"
          :min="1"
          :max="300"
          :placeholder="$t('system.deepseek.enterTimeout')"
        />
      </el-form-item> -->

      <el-form-item>
        <el-button
          type="primary"
          @click="handleSubmit"
        >
          {{ $t("formI18n.all.save") }}
        </el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import ConfigMixin from "./ConfigMixin";

export default {
  name: "deepseekEnvConfig",
  mixins: [ConfigMixin],
  data() {
    return {
      form: {
        enabled: false,
        apiKey: "",
        baseUrl: "https://api.deepseek.com/v1",
        model: "deepseek-chat",
        timeout: 60
      }
    };
  },
  async created() {
    this.activeName = "deepSeekEnvConfig";
    await this.handleClick();
  }
};
</script>

<style scoped>
.deepseek-config {
  width: 100%;
}

.mt10 {
  margin-top: 10px;
}
</style>
